package com.itheima.controller;

import com.itheima.pojo.Question;
import com.itheima.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: liangWeiQUQ
 * @Description: TODO
 * @DateTime: 2021/3/28 11:45
 **/
@RestController
@RequestMapping("system")
public class QuestionController {

    @Autowired
    private QuestionService questionService;

    @PostMapping("addQuestion")
    public Question addQuestion(@RequestBody Question question) {
        Question question1 = questionService.add(question);
        return question1;
    }

    @PostMapping("answer")
    public List<Question> findByAnswer(@RequestBody String title) {
        return  questionService.findByAnswer(title);

    }
}
